<?php include $this->header();?>
<form method="post" enctype="application/x-www-form-urlencoded" target="_self">
<?php foreach($actsList as $actApp => $actList) { ?>
<div class="p1 mt bd bg">
  <table class="list rank" width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr class="th">
      <td width="200" align="center"><b><?=$apps[$actApp]['app_name']?></b> 权限设置</td>
      <?php foreach($roles as $role) { ?>
      <td align="center"><?=$role['role_name']?></td>
      <?php } ?>
    </tr>
    <?php if(empty($actList)) continue; foreach($actList as $actCtl => $ctlList) { ?>
    <?php if(empty($ctlList)) continue; foreach($ctlList as $actAct => $actName) { ?>
    <tr>
      <td align="left"><input type="checkbox" class="check-act-all-role" /> <?=$actName?></td>
      <?php foreach($roles as $role) {?>
      <td align="center"><input type="checkbox" name="acl_item[<?=$actApp?>][<?=$actCtl?>][<?=$actAct?>][<?=$role['role_id']?>]" value="1" <?php if(!empty($aclsList[$actApp][$actCtl][$actAct][$role['role_id']])) {?> checked="checked"<?php }?> /></td>
      <?php } ?>
    </tr>
     <?php } ?>
     <?php } ?>
  </table>
</div>
<p class="bd bg pd" style="margin-top:-3px;">
  <input class="btn" type="submit" value="保存" />
  <input class="btn" type="reset" value="重置" />
</p>
<?php } ?>


</form>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
	$('.check-act-all-role').click(function(){
		if($(this).attr('checked')) {
			$(this).parent().parent().find('input').attr('checked', 'checked');
		} else {
			$(this).parent().parent().find('input').removeAttr('checked');
		}
	});
});
//]]>
</script>
<?php include $this->footer();?>